﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LocalEvents.Business
{
	public class HtmlHelper
	{
        // Removes unwanted HTML tags in Summary
        public static string FilterHtml(string htmlText)
        {
            return System.Text.RegularExpressions.Regex.Replace(htmlText, "<[^>]*>", "").Trim();
        }

        // Slice to certain words
        public static string FilterWords(string htmlText, int wordsCount)
        {
            var words = htmlText.Split(" ".ToCharArray());
            if(words.Length > wordsCount)
                return string.Join(" ", words, 0, wordsCount);
            return htmlText;
        }
	}
}
